Wraps this instance to the opposite edge of the given rectangle (typically the room’s own bounds) once it leaves it by more than margin.
move_wrap(left, top, right, bottom, margin = 0)| Name | Type |
|---|---|
left | real |
top | real |
right | real |
bottom | real |
margin | real (can be left out; then it is 0) |
Nothing.
Wraps this instance to the opposite edge of the given rectangle - typically the room's own bounds - once it leaves it by more than margin (leave it out for 0). The classic Asteroids-style screen wrap, applied to whatever rectangle is passed in rather than always the current room automatically.
left, top, right and bottom are places in the room, counted from the room's top-left corner (the same way x and y are). So 0, 0, room_width(), room_height() is the whole room.
This is wrap (Maths) applied to this instance's own position on both axes at once, with a margin a position wrap can use but a plain value wrap has no reason to. Reach for move_wrap when the thing wrapping is self's own x/y; reach for wrap when it is any other number - a menu index, a counter of your own.
move_wrap(0, 0, room_width(), room_height(), 8);Wraps the walker to the opposite edge of the room once it leaves it by more than 8 pixels - from the room's top-left corner (0, 0) to its bottom-right corner (room_width(), room_height()), the room's own full footprint.




margin can be left out: move_wrap(0, 0, room_width(), room_height()) is the same as passing 0 for it. This is wrap (Maths) applied to a position instead of an arbitrary value, on both axes at once, with a margin an ordinary value wrap has no use for - reach for move_wrap when the thing wrapping is this instance’s own x/y against a rectangle, and for wrap when it is any other number (a menu index, a counter of your own).